﻿<Window x:Class="LevelEditor.View.Windows.MainWindow" 
        Title="Level Editor"
        Height="350"
        Width="525"
        WindowStyle="SingleBorderWindow"
        UseLayoutRounding="True"
        SnapsToDevicePixels="True"
        Icon="/LevelEditor;component/Assets/UI/app-icon.png"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:uc="clr-namespace:LevelEditor.View.UserControls"
        xmlns:px="clr-namespace:LevelEditor.Utils.ImageSnappingToPixels"
        xmlns:ut="clr-namespace:LevelEditor.Utils"
        xmlns:cmd="clr-namespace:LevelEditor.Controllers"
        xmlns:mdlEnum="clr-namespace:LevelEditor.Model.Enum"
        xmlns:sys="clr-namespace:System;assembly=mscorlib">
    <FrameworkElement.Resources>
        <ResourceDictionary />
    </FrameworkElement.Resources>
    <UIElement.CommandBindings>
        <CommandBinding Command="{x:Static cmd:AppCommands.NewLevelCommand}" Executed="NewLevelCmd_Executed" CanExecute="OpenLevelCmd_CanExecute" />
        <CommandBinding Command="{x:Static cmd:AppCommands.OpenLevelSettingsCommand}" Executed="OpenLevelSettingsCmd_Executed" CanExecute="OpenLevelSettingsCmd_CanExecute" />
        <CommandBinding Command="{x:Static cmd:AppCommands.TogglePhysicEditorCommand}" Executed="TogglePhysicEditorCmd_Executed" CanExecute="TogglePhysicEditorCmd_CanExecute" />
        <CommandBinding Command="{x:Static cmd:AppCommands.OpenAssetsManagerCommand}" Executed="OpenAssetsManagerCmd_Executed" CanExecute="OpenAssetsManagerCmd_CanExecute" />
        <CommandBinding Command="{x:Static cmd:AppCommands.OpenSpriteSheetManagerCommand}" Executed="OpenSpriteSheetManagerCmd_Executed" CanExecute="OpenSpriteSheetManagerCmd_CanExecute" />
        <CommandBinding Command="{x:Static cmd:AppCommands.OpenAboutCommand}" Executed="OpenAboutCmd_Executed" CanExecute="OpenAboutCmd_CanExecute" />
        <CommandBinding Command="{x:Static cmd:AppCommands.OpenLevelCommand}" Executed="OpenLevelCmd_Executed" CanExecute="OpenLevelCmd_CanExecute" />
        <CommandBinding Command="{x:Static cmd:AppCommands.SaveLevelCommand}" Executed="SaveLevelCmd_Executed" CanExecute="SaveLevelCmd_CanExecute" />
        <CommandBinding Command="{x:Static cmd:AppCommands.SaveLevelAsCommand}" Executed="SaveLevelAsCmd_Executed" CanExecute="SaveLevelAsCmd_CanExecute" />
        <CommandBinding Command="{x:Static cmd:AppCommands.ExitCommand}" Executed="ExitCmd_Executed" CanExecute="ExitCmd_CanExecute" />
    </UIElement.CommandBindings>
    <DockPanel DockPanel.LastChildFill="True">
        <Menu DockPanel.Dock="Top" FocusManager.IsFocusScope="False">
            <MenuItem HeaderedItemsControl.Header="_File">
                <MenuItem HeaderedItemsControl.Header="_New..." Command="{x:Static cmd:AppCommands.NewLevelCommand}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_fileAdd.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Name="OpenMenuItem" Command="{x:Static cmd:AppCommands.OpenLevelCommand}" HeaderedItemsControl.Header="Open">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_open.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem HeaderedItemsControl.Header="_Save" Command="{x:Static cmd:AppCommands.SaveLevelCommand}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_save.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem HeaderedItemsControl.Header="Save _As..." Command="{x:Static cmd:AppCommands.SaveLevelAsCommand}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_save.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem HeaderedItemsControl.Header="_Exit" Command="{x:Static cmd:AppCommands.ExitCommand}" />
            </MenuItem>
            <MenuItem HeaderedItemsControl.Header="_Edit">
                <MenuItem HeaderedItemsControl.Header="Cu_t" Command="{x:Static cmd:AppCommands.CutGameSpriteCommand}" CommandTarget="{Binding ElementName=scenePanel}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_cut.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem HeaderedItemsControl.Header="_Copy" Command="{x:Static cmd:AppCommands.CopyGameSpriteCommand}" CommandTarget="{Binding ElementName=scenePanel}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_copy.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem HeaderedItemsControl.Header="_Paste" Command="{x:Static cmd:AppCommands.PasteGameSpriteCommand}" CommandTarget="{Binding ElementName=scenePanel}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_paste.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="De_select" Command="{x:Static cmd:AppCommands.DeselectGameSpriteCommand}" CommandTarget="{Binding ElementName=scenePanel}" />
                <MenuItem Header="_Delete" Command="{x:Static cmd:AppCommands.DeleteGameSpriteCommand}" CommandTarget="{Binding ElementName=scenePanel}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_delete.png"  />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem HeaderedItemsControl.Header="_View">
                <MenuItem HeaderedItemsControl.Header="Toggle _Grid" Command="{x:Static cmd:AppCommands.ToggleGridCommand}" CommandTarget="{Binding ElementName=scenePanel}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_grid.png"  />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem HeaderedItemsControl.Header="_Level">
                <MenuItem HeaderedItemsControl.Header="_Debug" Command="{x:Static cmd:AppCommands.DebugLevelCommand}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_debug.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem HeaderedItemsControl.Header="_Run" Command="{x:Static cmd:AppCommands.RunLevelCommand}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_run.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem HeaderedItemsControl.Header="_Properties" Command="{x:Static cmd:AppCommands.OpenLevelSettingsCommand}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_settings.png"  />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem HeaderedItemsControl.Header="_Tools">
                <MenuItem HeaderedItemsControl.Header="_Assets Manager" Command="{x:Static cmd:AppCommands.OpenAssetsManagerCommand}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_assetsManager.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem HeaderedItemsControl.Header="_Toggle Physic Editor Mode" Command="{x:Static cmd:AppCommands.TogglePhysicEditorCommand}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_box2d.png"  />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem HeaderedItemsControl.Header="SpriteSheet _Editor" Command="{x:Static cmd:AppCommands.OpenSpriteSheetManagerCommand}">
                    <MenuItem.Icon>
                        <px:Bitmap Source="/LevelEditor;component/Assets/UI/ico_film.png"  />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem HeaderedItemsControl.Header="_?">
                <MenuItem HeaderedItemsControl.Header="_About Level Editor" Command="{x:Static cmd:AppCommands.OpenAboutCommand}" />
            </MenuItem>
        </Menu>
        <ToolBarTray DockPanel.Dock="Top">
            <ToolBar FocusManager.IsFocusScope="False">
                <Button Command="{x:Static cmd:AppCommands.NewLevelCommand}">
                    <px:Bitmap Source="/Assets/UI/ico_fileAdd.png"  />
                </Button>
                <Separator />
                <Button Command="{x:Static cmd:AppCommands.OpenLevelCommand}">
                    <px:Bitmap Source="/Assets/UI/ico_open.png"  />
                </Button>
                <Button Command="{x:Static cmd:AppCommands.SaveLevelCommand}">
                    <px:Bitmap Source="/Assets/UI/ico_save.png"  />
                </Button>
                <Separator />
                <Button Command="{x:Static cmd:AppCommands.CutGameSpriteCommand}" CommandTarget="{Binding ElementName=scenePanel}">
                    <px:Bitmap Source="/Assets/UI/ico_cut.png"  />
                </Button>
                <Button Command="{x:Static cmd:AppCommands.CopyGameSpriteCommand}" CommandTarget="{Binding ElementName=scenePanel}">
                    <px:Bitmap Source="/Assets/UI/ico_copy.png"  />
                </Button>
                <Button Command="{x:Static cmd:AppCommands.PasteGameSpriteCommand}" CommandTarget="{Binding ElementName=scenePanel}">
                    <px:Bitmap Source="/Assets/UI/ico_paste.png"  />
                </Button>
                <Separator />
                <Button Name="DebugLevel" Command="{x:Static cmd:AppCommands.DebugLevelCommand}">
                    <px:Bitmap Source="/Assets/UI/ico_debug.png"  />
                </Button>
                <Button Name="RunLevel" Command="{x:Static cmd:AppCommands.RunLevelCommand}">
                    <px:Bitmap Source="/Assets/UI/ico_run.png"  />
                </Button>
                <Button Name="OpenLevelSettings" Command="{x:Static cmd:AppCommands.OpenLevelSettingsCommand}">
                    <px:Bitmap Source="/Assets/UI/ico_settings.png"  />
                </Button>
                <Separator />
                <Button Name="ToggleGrid" Command="{x:Static cmd:AppCommands.ToggleGridCommand}" CommandTarget="{Binding ElementName=scenePanel}">
                    <px:Bitmap Source="/Assets/UI/ico_grid.png"  />
                </Button>
                <Separator />
                <Button Name="OpenAssetsEditor" Command="{x:Static cmd:AppCommands.OpenAssetsManagerCommand}">
                    <px:Bitmap Source="/Assets/UI/ico_assetsManager.png"  />
                </Button>
                <Button Name="OpenBox2DEditor" Command="{x:Static cmd:AppCommands.TogglePhysicEditorCommand}">
                    <px:Bitmap Source="/Assets/UI/ico_box2d.png"  />
                </Button>
                <Button Name="OpenSpriteSheetEditor" Command="{x:Static cmd:AppCommands.OpenSpriteSheetManagerCommand}">
                    <px:Bitmap Source="/Assets/UI/ico_film.png"  />
                </Button>
            </ToolBar>
        </ToolBarTray>
        <StatusBar Name="statusBar1" FrameworkElement.Height="23" DockPanel.Dock="Bottom">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition RowDefinition.Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition ColumnDefinition.Width="*" />
                            <ColumnDefinition ColumnDefinition.Width="Auto" />
                            <ColumnDefinition ColumnDefinition.Width="90" />
                        </Grid.ColumnDefinitions>
                    </Grid>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <StatusBarItem Grid.Column="1">
                <TextBlock>
          Pos:
                </TextBlock>
            </StatusBarItem>
            <StatusBarItem Grid.Column="2">
                <TextBlock Name="MousePos">
          ?
                </TextBlock>
            </StatusBarItem>
        </StatusBar>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition ColumnDefinition.Width="200" />
                <ColumnDefinition ColumnDefinition.Width="Auto" />
                <ColumnDefinition ColumnDefinition.Width="*" />
                <ColumnDefinition ColumnDefinition.Width="Auto" />
                <ColumnDefinition ColumnDefinition.Width="200" />
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0" FrameworkElement.Width="Auto" FrameworkElement.Height="Auto">
                <Grid.RowDefinitions>
                    <RowDefinition RowDefinition.Height="*" />
                </Grid.RowDefinitions>
                <uc:GameElementsPanel x:Name="gameElementsPanel" Grid.Row="0"/>
            </Grid>
            <GridSplitter FrameworkElement.HorizontalAlignment="Right" FrameworkElement.VerticalAlignment="Stretch" Grid.Column="1" GridSplitter.ResizeBehavior="PreviousAndNext" FrameworkElement.Width="5" />
            <Grid Grid.Column="2" FrameworkElement.Width="Auto">
                <Grid.RowDefinitions>
                    <RowDefinition RowDefinition.Height="*" />
                </Grid.RowDefinitions>
                <uc:ScenePanel x:Name="scenePanel" Grid.Row="0" Control.Background="#FFDEDEDE"/>
            </Grid>
            <GridSplitter FrameworkElement.HorizontalAlignment="Right" FrameworkElement.VerticalAlignment="Stretch" Grid.Column="3" GridSplitter.ResizeBehavior="PreviousAndNext" FrameworkElement.Width="5" />
            <Grid Grid.Column="4" FrameworkElement.Width="Auto">
                <Grid.RowDefinitions>
                    <RowDefinition RowDefinition.Height="150" />
                    <RowDefinition RowDefinition.Height="*" />
                    <RowDefinition RowDefinition.Height="Auto" />
                    <RowDefinition RowDefinition.Height="*" />
                </Grid.RowDefinitions>
                <uc:NavigatorPanel x:Name="navigatorPanel" Grid.Row="0" />
                <uc:LayersPanel x:Name="layersPanel" Grid.Row="1" />
                <GridSplitter HorizontalAlignment="Stretch" FrameworkElement.VerticalAlignment="Top" Grid.Row="2" GridSplitter.ResizeBehavior="PreviousAndNext" FrameworkElement.Height="5" />
                <uc:PropertiesPanel x:Name="propertiesPanel" Grid.Row="3"/>

            </Grid>
        </Grid>
    </DockPanel>
</Window>


 
